package com.hudson.plugin.result.collector.server.datastore.internal.entity;

import javax.persistence.Basic;
import javax.persistence.Entity;
import javax.persistence.Id;

/**
 * User: yuxinlei
 * Date: 5/24/11
 * Time: 11:44 AM
 */
@javax.persistence.Table(name = "build_relations", catalog = "reportdb")
@Entity
public class BuildRelationsEntity {
    private int id;

    @javax.persistence.Column(name = "id", nullable = false, insertable = true, updatable = true, length = 10, precision = 0)
    @Id
    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    private int parentId;

    @javax.persistence.Column(name = "parent_id", nullable = true, insertable = true, updatable = true, length = 10, precision = 0)
    @Basic
    public int getParentId() {
        return parentId;
    }

    public void setParentId(int parentId) {
        this.parentId = parentId;
    }

    private int childId;

    @javax.persistence.Column(name = "child_id", nullable = true, insertable = true, updatable = true, length = 10, precision = 0)
    @Basic
    public int getChildId() {
        return childId;
    }

    public void setChildId(int childId) {
        this.childId = childId;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        BuildRelationsEntity that = (BuildRelationsEntity) o;

        if (childId != that.childId) return false;
        if (id != that.id) return false;
        if (parentId != that.parentId) return false;

        return true;
    }

    @Override
    public int hashCode() {
        int result = id;
        result = 31 * result + parentId;
        result = 31 * result + childId;
        return result;
    }
}
